///|
pub enum Sign {
  //正值 +号
  Positive
  //负值 -号
  Negative
}

///|
fn Sign::to_int(self : Sign) -> Int {
  match self {
    Positive => 1
    Negative => -1
  }
}

///|
pub impl Eq for Sign with op_equal(self : Sign, other : Sign) -> Bool {
  return self.to_int() == other.to_int()
}

///|
pub impl Compare for Sign with compare(self : Sign, other : Sign) -> Int {
  // self < other
  if self == Sign::Negative && other == Positive {
    return -1
  }
  // self > other
  if self == Sign::Positive && other == Negative {
    return 1
  }
  // self==other
  return 0
}

///|
pub fn to_math_symbol(self : Sign) -> Char {
  match self {
    Positive => '+'
    Negative => '-'
  }
}
